<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:88:"D:\phpStudy\PHPTutorial\WWW\xbs22\fly\public/../application/admin\view\del\user_del.html";i:1542166757;s:72:"D:\phpStudy\PHPTutorial\WWW\xbs22\fly\application\admin\view\layout.html";i:1542336746;}*/ ?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>后台登录-X-admin2.0</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
	<link rel="stylesheet" href="/static/admin/css/font.css">
	<link rel="stylesheet" href="/static/admin/css/xadmin.css">
	<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
	<script src="/static/admin/lib/layui/layui.js" charset="utf-8"></script>
	<script type="text/javascript" src="/static/admin/js/xadmin.js"></script>
</head>
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">演示</a>
        <a>
          <cite>导航元素</cite></a>
      </span>
	<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
		<i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
	<div class="layui-row">
		<form class="layui-form layui-col-md12 x-so">
			<input type="text" name="nickname" value="<?php echo input('nickname'); ?>"  placeholder="请输入用户名" autocomplete="off" class="layui-input">
			<button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
		</form>
	</div>
	<xblock>
		<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量恢复</button>
		<span class="x-right" style="line-height:40px">共有数据：<?php echo $users->total(); ?> 条</span>
	</xblock>
	<table class="layui-table">
		<thead>
		<tr>
			<th>
				<div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
			</th>
			<th>ID</th>
			<th>用户名</th>
			<th>性别</th>
			<th>手机</th>
			<th>邮箱</th>
			<th>地址</th>
			<th>账号状态</th>
			<th>加入时间</th>
			<th>目前状态</th>
			<th>操作</th>
		</thead>
		<tbody>
		<?php if(is_array($users) || $users instanceof \think\Collection || $users instanceof \think\Paginator): $i = 0; $__LIST__ = $users;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$user): $mod = ($i % 2 );++$i;?>
		<tr>
			<td>
				<div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='<?php echo $user['user_id']; ?>'><i class="layui-icon">&#xe605;</i></div>
			</td>
			<td><?php echo $user['user_id']; ?></td>
			<td><?php echo $user['nickname']; ?></td>
			<td><?php echo $user['sex']==1 ? '女' :'男'; ?></td>
			<td><?php echo $user['phone']; ?></td>
			<td><?php echo $user['email']; ?></td>
			<td><?php echo $user['city']; ?></td>
			<td class="td-status">
				<?php if($user['static']==0): ?>
				<span class="layui-btn layui-btn-normal layui-btn-mini">已启用</span>
				<?php else: ?>
				<span class="layui-btn layui-btn-normal layui-btn-mini layui-btn-disabled">已禁用</span>
				<?php endif; ?>
			</td>
			<td><?php echo $user['create_time']; ?></td>
			<td class="td-status">
              <span class="layui-btn layui-btn-danger layui-btn-mini">
                                已删除
                            </span>
			<td class="td-manage">
				<a title="恢复" onclick="member_recover(this,<?php echo $user['user_id']; ?>)" href="javascript:;">
					<i class="layui-icon">&#xe618;</i>
				</a>
				<a title="彻底删除" onclick="member_del(this,<?php echo $user['user_id']; ?>)" href="javascript:;">
					<i class="layui-icon">&#xe640;</i>
				</a>
			</td>
		</tr>
		<?php endforeach; endif; else: echo "" ;endif; ?>
		</tbody>
	</table>
	<div class="page">
		<?php echo $users->render(); ?>
	</div>

</div>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });
        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });
    /*用户-删除*/
    function member_del(obj,id){
        layer.confirm('确认彻底删除该用户吗？',function(index){
            //发异步删除数据
			$.post("<?php echo url('admin/Del/delTrue'); ?>", {user_id: id}, function(res, textStatus, xhr) {
                if (res.code == 0) {
                    layer.msg(res.msg, function () {
                    });
                } else {
                    layer.alert(res.msg, function () {
                        location.reload();
                    })
                }
			});
        });
    }

    function member_recover(obj,id){
        layer.confirm('确定恢复该用户吗？',function(index){
            //发异步删除数据
            $.post("<?php echo url('admin/Del/recover'); ?>", {user_id: id}, function(res, textStatus, xhr) {
                if (res.code == 0) {
                    layer.msg(res.msg, function () {
                    });
                } else {
                    layer.alert(res.msg, function () {
                        location.reload();
                    })
                }
            });
        });
    }

    function delAll (argument) {
        var data = tableCheck.getData();
        layer.confirm('确认要恢复吗？',function(index){
            //捉到所有被选中的，发异步进行删除
            $.post("<?php echo url('admin/Del/recoverAll'); ?>", {user_id: data}, function(res, textStatus, xhr) {
                if (res.code == 0) {
                    layer.msg(res.msg, function () {
                    });
                } else {
                    layer.alert(res.msg, function () {
                        location.reload();
                    })
                }
            });
        });
    }
</script>
</body>
